<template>
  <div>
    <van-tabbar v-model="active" active-color="black" inactive-color="white">
      <van-tabbar-item to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/topic" icon="label-o">专题</van-tabbar-item>
      <van-tabbar-item to="/category" icon="apps-o">分类</van-tabbar-item>
      <van-tabbar-item to="/cart" icon="cart-o">购物车</van-tabbar-item>
      <van-tabbar-item to="/user" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'AppTabbar',
  components: {},
  props: [],
  data () {
    return {
      // * 被点击的 tabbar, 不能写死，应绑定当前路由，否则刷新就回到 "默认值"
      // ? 应该绑定 this.$route.meta 里面携带的信息
      // active: this.$route.meta.activeNum
    }
  },
  computed: {
    active: { // 用这种方法可以解决多次点击出现错误情况
      get () {
        return this.$route.meta.activeNum
      },
      set () {}
    }
  },
  created () {},
  mounted () {},
  watch: {},
  methods: {}
}
</script>

<style lang='less'>
.van-tabbar-item{
  background-color: #c0c0c0;
}
</style>
